define(function(require, exports, module) {
	var $ = require('jquery')
	var Spine = require('spine')
	require('jquery.tmpl')
	var DirectoryItem = Spine.Controller.sub({
		events: {
			'click .done-button': function() {
				this.model.path = $.fn.zTree.getZTreeObj('tree').getSelectedNodes()[0].trac
				DirectoryItem.trigger('move', {
					path: this.model.path
				})
				$.fancybox.close()
				this.model.destroy()
			}
		},
		init: function() {
			this.model.bind('destroy', this.release)
		},
		render: function() {
			this.replace($('#directoryTemplate').tmpl(this.model))
			return this
		}
	})
	DirectoryItem.extend(Spine.Events)
	module.exports = DirectoryItem
})